import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/manage/rule',
    method: 'get',
    params: query
  })
}

export function fetchRule() {
  return request({
    url: '/manage/rule',
    method: 'get'
  })
}

export function createRule() {
  return request({
    url: 'manage/rule/create',
    method: 'get'
  })
}

export function saveRule(data) {
  return request({
    url: '/manage/rule',
    method: 'post',
    data
  })
}

export function updateRule(data) {
  return request({
    url: '/manage/rule/' + data.id,
    method: 'put',
    data
  })
}

export function deleteRule(id, status) {
  return request({
    url: '/manage/rule/' + id,
    method: 'delete',
    data: { flag: status }
  })
}
